package com.plian.system.wrapper.dp;

import com.plian.system.dto.dp.ResponsiblePersonDTO;
import com.plian.system.entity.dp.ResponsiblePerson;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.dp.ResponsiblePersonVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * 责任人员信息（不包括行政处罚人员）包装类,返回视图层所需的字段
 *
 * @author jianglei
 * @since 2019-12-05
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface ResponsiblePersonWrapper extends BaseWrapper<ResponsiblePerson, ResponsiblePersonDTO, ResponsiblePersonVO> {

	@Override
	@Mappings(value = {
			@Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
			@Mapping(source = "updateUser", target = "updateUserName", qualifiedByName = USER_ID_TO_NAME),
			@Mapping(source = "rankId", target = "rankName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "jobId", target = "jobName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "companyId", target = "companyName", qualifiedByName = PROPERTY_ID_NAME)
	})
	ResponsiblePersonVO entityToVO(ResponsiblePerson entity);

}
